#pragma once
#include "cv.h"
#include "highgui.h"
#include <string>
#include <vector>
#include "CTruthDataPoint.h"
class CDataPointManager
	{
	public:
		CDataPointManager(void);
		CDataPointManager(std::string fname, std::string path);
		/*
		Try to load count images from the path using the extension, quick and dirty approach.
		*/
		CDataPointManager(std::string baseName, std::string path, std::string ext, int count, int nwidth=3, int startIndex=1);

		virtual ~CDataPointManager(void);
		CTruthDataPoint* GetDataPoint( int index );
		void AddDataPoint( CTruthDataPoint* dp );
		void AddDataPoint( IplImage* img, std::string inFile, double classification, CvPoint pt, CvSize sz);
		int GetSize(void);
		int GetNextElement(void);
		bool WriteToFile( std::string fname );
		bool ReadFromFile( std::string fname );
		std::vector<std::string> GetCurrentFiles(void);
		void SetBaseName( std::string baseName );
		std::string GetBaseName( void );
		double GetClassificationError(void);
		void SetClassificationTruth( double truth_label ); 
		void SetFileType( std::string fType );
		std::string GetFileType(void); 
		CTruthDataPoint*  GetCurrentPoint(void){return m_data[GetSize()];};
		int LoadAllImages(void);
		bool SaveAllImages(void);

		void SetPath(std::string path){m_path=path;};
		std::string GetPath( void ){return m_path;};
	protected:
		std::vector<CTruthDataPoint*> m_data;
		std::string m_baseName;
		std::string m_fileType;
		std::string m_path;
	};
